<script setup>
import { ref, computed, watch, onMounted } from 'vue'
import ImgAvatar from '@/assets/imgs/img_tx_kzt.png'

const props =defineProps({
  data: Object,
})

const recordList = computed(() => Array.from({ length: 10 }))

const getAttendanceInfo = (item) => {
  return Array.from({ length: 5 }).map(e => {
    const key = 'name'
    const value = 'value'
    return [ key, value ]
  })
  return item.attendanceInfo.map((item) => {
    return {
      key: item.name,
      value: item.time,
    }
  })
}
</script>

<template>
    <div class="project-baseinfo">
        <div class="head">人员到岗</div>
        <el-scrollbar style="height: 830px;">
            <div class="list-wrap">
                <div class="attendance-card" v-for="item in data" :key="item.pkid">
                    <div class="avatar">
                        <img class="img" :src="ImgAvatar" alt="">
                    </div>
                    <div class="info-wrap">
                        <div class="info-line">
                            <span class="tit">姓名：</span>
                            <span class="text">{{ item.userName }}（{{ item.post }}）</span>
                        </div>
                        <div class="info-line">
                            <span class="tit">公司：</span>
                            <span class="text">{{ item.unitName }}</span>
                        </div>
                        <div class="info-line">
                            <span class="tit">班组名称：</span>
                            <span class="text">{{ item.teamsName }}</span>
                        </div>
                        <div class="info-line">
                            <span class="tit">工种：</span>
                            <span class="text">{{ item.profession }}</span>
                        </div>
                        <div class="info-line">
                            <span class="tit">状态：</span>
                            <span class="text">{{ item.status }}</span>
                        </div>
                        <div class="info-line">
                            <span class="tit">通过时间：</span>
                            <span class="text">{{ item.signInTime }}</span>
                        </div>
                    </div>
                </div>
                <div class="no-data" v-if="!data.length">暂无数据</div>
            </div>
        </el-scrollbar>
    </div>
</template>

<style lang="scss" scoped>
.project-baseinfo {
    padding: 20px;
    box-sizing: border-box;

    .head {
        text-align: center;
        color: #fff;
        text-align: center;
        color: #fff;
        line-height: 40px;
        margin-bottom: 20px;
    }
    .list-wrap {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        .attendance-card {
            flex: 0 0 50%;
            height: 160px;
            margin-bottom: 60px;
            color: #fff;
            display: flex;
            .avatar {
                flex: 0 0 110px;
                height: 100%;
                border: 1px solid #fff;
                margin-right: 20px;
                .img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }
            .info-line {
                display: flex;
                align-items: center;
                line-height: 28px;
                .tit {
                    color: #B9BAB2;
                }
            }
        }

        .no-data {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100px;
            color: #B9BAB2;
        }
    }
}
</style>